<?php
class HTML {
	public static function createHeader($siteName, $customCSS = '') {
		echo '
		<!DOCTYPE html>
		<html lang="de">
		<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="' . $siteName . '">
		<meta name="author" content="N.Hutter">
		<!-- <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">-->
		
		<title>' . $siteName . '</title>
		
		<!-- Bootstrap core CSS -->
		<link href="/css/bootstrap.css" rel="stylesheet">
		
		<!-- Main CSS for Page -->
		<link href="/css/main.css" rel="stylesheet">	
		<link href="/css/jquery.simple-dtpicker.css" rel="stylesheet">';
				
		if($customCSS != ''){
			echo'<!-- Custom styles for this site -->
				<link href="/css/' . $customCSS . '" rel="stylesheet">';
		}
				
		echo'<link href="/img/favicon.png" rel="icon" type="image/x-icon" />
				
    	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
		    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
		    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
		<![endif]-->
		</head>';
	}
	public static function createMaintenance() {
		// code here
	}
	public static function createLogobar($user = null) {
		$active = $_SERVER['PHP_SELF'];
		   echo'    
	<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <!--<a class="navbar-brand" href="index.php">Startseite</a>-->
        </div>';
		   
		   
		   //inhalt ausgeklappt
		   echo'
		
        <div class="navbar-collapse collapse">
		   		
		   <ul class="nav navbar-nav">';
		   
		   	if($active=='/index.php'){
		   		echo '<li class="active"><a href="index.php">Startseite</a></li>';
			}else {
				echo '<li><a href="index.php">Startseite</a></li>';
			}
			if(is_null($user) || $user->getGrant() <2){
			   	if($active=='/tickets.php'){
			   		echo '<li class="active"><a href="tickets.php">Tickets</a></li>';
				}else{
			   		echo '<li><a href="tickets.php">Tickets</a></li>';
				}
			}
			
			if(!is_null($user) && $user->getGrant() >=2){
				if($active=='/tickets.php'){
			   		echo '<li class="active"><a href="tickets.php">Tickets</a></li>';
			   	}else{
			   		echo '<li><a href="tickets.php">Tickets</a></li>';
			   	}
			   	if($active=='/tickets_open.php'){
			   		echo '<li class="active"><a href="tickets_open.php">Offene Tickets</a></li>';
			   	}else{
			   		echo '<li><a href="tickets_open.php">Offene Tickets</a></li>';
			   	}
			   	if($active=='/tickets_edit.php'){
			   		echo '<li class="active"><a href="tickets_edit.php">Tickets bearbeiten</a></li>';
			   	}else{
			   		echo '<li><a href="tickets_edit.php">Tickets bearbeiten</a></li>';
			   	}
			   	if($active=='/users.php'){
			   		echo '<li class="active"><a href="users.php">Benutzerrechte ändern</a></li>';
			   	}else{
			   		echo '<li><a href="users.php">Benutzerrechte ändern</a></li>';
			   	}
			}
		   	if($user != null){	  
		   	echo' <li><a href="logout.php">Logout</a></li>';
		   	}
		   			
		   
		   	//Sign In
		   	if($user == null){
		   		echo'
		   				</ul>
          <form class="navbar-form navbar-right" method="post" action="signin.php">
            <div class="form-group">
              <input type="email" placeholder="Email" class="form-control" name="email" required>
            </div>
            <div class="form-group">
              <input type="password" placeholder="Password" class="form-control" name="password" required>
            </div>
            <button type="submit" class="btn btn-success" name="submit">Sign in</button>
          </form>';
		   	}else{
		   		echo '<li><a href="/users_modify.php?id='.$user->getUser_id(). '&email='.$user->getEmail().'&grant='.$user->getGrant().'" data-toggle="tooltip" title="Ändern Sie hier ihr Profil">'.$user->getEmail().'</a></li>';
		   		echo '</ul>';
		   	}
		   	echo '
        </div><!--/.navbar-collapse -->
      </div>
    </div>';
	}
	
	public static function createIntroduction(){
		echo'
	<!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="jumbotron">
      <div class="container">
        <h1>Willkommen beim Ticketing System</h1>
        <p>Dies ist die Startseite dieses Ticketing Systems. Um zur &Uuml;bersicht Ihrer Tickets zu gelangen, folgen sie dem untenstehenden Link:</p>
        <p><a href="tickets.php" class="btn btn-primary btn-lg" role="button">Tickets &raquo;</a></p>
      </div>
    </div>
				';
	}
	public static function noScript() {
		echo ' 
		<noscript>
		<div class="container">
		<div class="row">
		<div class="col-md-12">
		<h3 style="color: red;">Dieses Ticketing System benutzt JavaScript</h3>
		<p>
		Bitte aktiviere in deinen Browsereinstellungen JavaScript damit diese Applikation voll funktionsfähig ist
		</p>
		</div>
		</div>
		</div>
		</noscript>';
	}
	public static function createFooter() {
		echo '
		<footer>
			<div class="row">
      			<div class="col-md-2 col-md-offset-10">
      				<p class="text-right" >&copy; N.Hutter</p>
				</div>
      		</div>
		<footer>';
	}
	
	public static function includeJS() {
			echo '<script src="../jquery/jquery-2.0.3.js"></script>';
			echo '<script src="../js/bootstrap.js"></script>';
	
	}
	public static function dbNotAvailable() {
		session_destroy ();
		die ( '
				<div class="row">
				<div class="col-md-12">
				<h3>Datenbank nicht erreichbar</h3>
				<p>
				Die Datenbank ist zurzeit nicht erreichbar, bitte versuchen sie es später erneut.
				</p>
				</div>
				</div>
	' );
	}
	public static function getSearchSettings(){
		echo'
		<h3>Suche</h3>
		<form action="computerlist.php" method="post" >

		<table>
		<tr><td style="width: 100px;">Computrname</td><td><input  style="width:155px" type="text" name="computername" value="'; if( isset($_POST['computername'])){echo $_POST['computername'];} echo'"></td></tr>
		<tr><td>Computertyp</td><td><input style="width:155px" type="text" name="computer_type" value="'; if( isset($_POST['computer_type'])){echo $_POST['computer_type'];} echo'"></td></tr>
		<tr><td>IP Adresse</td><td><input style="width:155px" type="text" name="ip_address" value="'; if( isset($_POST['ip_address'])){echo $_POST['ip_address'];} echo'"></td></tr>
		<tr><td>CPU Name</td><td><input style="width:155px" type="text" name="cpu_name" value="'; if( isset($_POST['cpu_name'])){echo $_POST['cpu_name'];} echo'"></td></tr>
		<tr><td>BS Name</td><td><input style="width:155px" type="text" name="os_name" value="'; if( isset($_POST['os_name'])){echo $_POST['os_name'];} echo'"></td></tr>
		<tr><td>Scans von</td><td> <input  style="width:155px" type="text" name="starttime" value="'; if( isset($_POST['starttime'])){echo $_POST['starttime'];}else{echo'2000-01-01 00:00';} echo'"></td></tr>
		<tr><td>bis			 </td><td>  <input  style="width:155px" type="text" name="endtime" value="'; if( isset($_POST['endtime'])){echo $_POST['endtime'];} echo'"></td></tr>
		
        <script type="text/javascript">
                $(function(){
                        $("*[name=starttime]").appendDtpicker({"firstDayOfWeek": 1});
						$("*[name=endtime]").appendDtpicker({"firstDayOfWeek": 1});
                });
        </script>
		</table>		
		<p><button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span> Suche</button></p>
		 ';
	}
	public static function getFilterSettings(){
		echo'<h3>Zusätzliche Spalten:</h3>
		<input type="checkbox" class="filterCB" name="ram_size"'; if( isset($_POST['ram_size'])){echo 'checked="checked"';} echo'>  RAM Grösse</br>
		<input type="checkbox" class="filterCB" name="ram_speed"'; if( isset($_POST['ram_speed'])){echo 'checked="checked"';} echo'>  RAM Tacktrate</br>
		<input type="checkbox" class="filterCB" name="ram_manufacturer"'; if( isset($_POST['ram_manufacturer'])){echo 'checked="checked"';} echo'>  RAM Hersteller</br>
		<input type="checkbox" class="filterCB" name="os_version"'; if( isset($_POST['os_version'])){echo 'checked="checked"';} echo'>  BS Version</br>
		<input type="checkbox" class="filterCB" name="os_architecture"'; if( isset($_POST['os_architecture'])){echo 'checked="checked"';} echo'>  BS Archidektur</br>
		<input type="checkbox" class="filterCB" name="cpu_manufacturer"'; if( isset($_POST['cpu_manufacturer'])){echo 'checked="checked"';} echo'>  CPU Hersteller</br>
		<input type="checkbox" class="filterCB" name="cpu_number_of_cores"'; if( isset($_POST['cpu_number_of_cores'])){echo 'checked="checked"';} echo'>  CPU anz. Kerne</br>
		<input type="checkbox" class="filterCB" name="cpu_max_clock_speed"'; if( isset($_POST['cpu_max_clock_speed'])){echo 'checked="checked"';} echo'>  CPU Tacktrate</br></br>
		
		<p><input type="checkbox" name="archiv"'; if( isset($_POST['archiv'])){echo 'checked="checked"';} echo'> nur Archivierte Computer anzeigen</p>
		<p><button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-refresh"></span> Aktuallisieren</button></p>
		</form>';
	}

}

?>